package com.tg.app.widget;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.demo.view.TGBottomSheetDialog;
import com.tg.app.R;
import com.tg.app.activity.device.CameraViewActivity;
import com.tange.base.toolkit.DimenUtil;

import java.util.Objects;

public class PtzControlDialog extends TGBottomSheetDialog {
    private PtzControlView ptzControlView;
    public PtzControlDialog(Context context,@NonNull PtzControlView.OnPtzControlTouchListener onPtzControlTouchListener) {
        super(context);
        ptzControlView.setOnPtzControlTouchListener(onPtzControlTouchListener);
        Objects.requireNonNull(bottomSheetDialog.getWindow()).setDimAmount(0f);
    }

    @Override
    protected int getContentView() {
        return R.layout.dialog_bottom_sheet_ptz_control;
    }

    @Override
    protected void initView(@NonNull View view) {
       ViewGroup.LayoutParams layoutParams =  view.getLayoutParams();
        CameraViewActivity activity = (CameraViewActivity) context;
        layoutParams.height  = activity.getContainerHeight()+ DimenUtil.dp2px(context,98);
        view.setLayoutParams(layoutParams);
        ptzControlView = view.findViewById(R.id.bottom_sheet_ptz_control);
        ptzControlView.setClickable(true);
        ptzControlView.setImageView(R.mipmap.ic_tange_switch_ptz);
        view.findViewById(R.id.btn_dialog_ptz_control_close).setOnClickListener(v -> dismiss());
    }
}
